feat(transports): add HTTP/WebSocket transport support#7
Draft
kamikaz1k wants to merge 9 commits into
Draft
Conversation
b75753f to
f706d17
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RFD: https://agentclientprotocol.com/rfds/streamable-http-websocket-transport
Other Implementations
This PR adds support for the HTTP SSE protocol for both client and server.
Remaining Work
AcpAgentSessionOpen Questions
Implementation specific notes / questions
I've introduced a strict and compatible mode, to allow stricter protocol adherence. This can be helpful for debugging paths, but I don't see an existing pattern for this so I am not sure if this is good to include.
Client handler return-value forwarding: I noticed that in the WS version, the transport client was forwarding the client handler's return message. For example, a request permission message would be returned to the server. There should be no handler registered, so the server would return a "-32601 Method not found". I've Mirrored WS behaviour for compatibility, but I think this is a bug. And opened a separate PR to discuss.
When a method is not recognized, in compatible mode we try to pass through as Session scoped / Route scoped based on presence of session id. This might be a RFD question as well. But this logic is in the transport layer, which maybe is not appropriate.
validateClientResponseScope handles mismatching requests as warnings, this is same as existing WS behaviour, but might be codified in the protocol. This seems safe since server is source of truth and there's no follow up action that can be taken inherently since its trying to associate a response to non-existent request. Agent behaviour isn't affected, but we might be able to do better from a protocol design POV.
The AcpAgentSession assumes a single active prompt because in WS its one connection one session. But with HTTP, there's . So we will probably need to do nudge users to a new interface for WS and HTTP to remain compatible.
I have a test harness to test the correctness in an integration test in a language agnostic way. I was thinking we could use this as a way to test implementation across languages. It doesn't belong in this SDK, but I still wanted to share to get some feedback.
RFD clarifications that I'll follow up on